//
//  LGCultureVideoDetailViewController.m
//  ligenyun
//
//  Created by Mac on 2018/3/28.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "LGCultureVideoDetailViewController.h"
#import "LGCultureCommentTableViewCell.h"
@interface LGCultureVideoDetailViewController ()
@property(nonatomic, strong) STLabel                     *numLable;
@end

@implementation LGCultureVideoDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"详情";
    [self configSubView];
    [self configFooterAndBottomView];
    // Do any additional setup after loading the view.
}

#pragma mark --subView
- (void)configSubView{
    UIView * header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 30)];
    header.backgroundColor = [UIColor whiteColor];
    UIImageView * bannerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, UIScreenWidth, 150)];
    bannerImageView.image = [UIImage imageNamed:@"文化交流banner"];
    [header addSubview:bannerImageView];
    
    UIView * titleView = [TMUtils headerViewWithTitle:@"相关视频"];
    titleView.top = bannerImageView.bottom;
    [header addSubview:titleView];
    
    LGCultureVideoCollectionView * collectionView = [LGCultureVideoCollectionView initWithDefultFrame];
    collectionView.top = titleView.bottom;
    [header addSubview:collectionView];
    
    
    UIView * line = [[UIView alloc] initWithFrame:CGRectMake(0, collectionView.bottom, UIScreenWidth, 10)];
    line.backgroundColor = self.tableView.backgroundColor;
    [header addSubview:line];
    
    self.numLable = [[STLabel alloc] initWithFrame:CGRectMake(0, line.bottom, UIScreenWidth, 44)
                                                     text:@"    网友评论(10)"
                                                textColor:SecendTextColor
                                                     font:14
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    [header addSubview:self.numLable];
    
    header.height = self.numLable.bottom;
    self.tableView.tableHeaderView = header;
}
- (void)configFooterAndBottomView{
    UIView * footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 49)];
    self.tableView.tableFooterView = footer;
    __weak typeof(self) weakSelf =  self;
    UIView * bootomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 49)];
    bootomView.top = [TMUtils tabBarTop];
    bootomView.backgroundColor = [UIColor whiteColor];
    [bootomView st_showTopShadow];
    STButton * buyButton = [[STButton alloc] initWithFrame:CGRectMake(0, 1, UIScreenWidth, 48)
                                                     title:@"说点什么吧"
                                                titleColor:SecendTextColor
                                                 titleFont:14
                                              cornerRadius:0
                                           backgroundColor:nil
                                           backgroundImage:nil
                                                     image:nil];
    buyButton.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
    [bootomView addSubview:buyButton];
    [buyButton setClicAction:^(UIButton *sender) {
        LGCultureCommentPresentController * vc = [LGCultureCommentPresentController new];
        [vc setOnSelctedSendHandle:^(NSString *text) {
            
        }];
        [weakSelf presentViewController:vc animated:NO completion:nil];
    }];
    [self.view addSubview:bootomView];
}
#pragma --mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 10   ;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return [LGCultureCommentTableViewCell cellHeight];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 0.01;
}
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return [UIView new];
}
- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return [UIView new];
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
    [cell st_showAnimationWithType:STAnimationTypekCATransitionFade];
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * reuseIdentifier =  @"cell";
    LGCultureCommentTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[LGCultureCommentTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
    }
    return cell;
}
#pragma --mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
}


@end
